
<!DOCTYPE HTML>
<html lang="zh-hans" >
    <head>
        <meta charset="UTF-8">
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <title>编码规范 · TypeScript Handbook</title>
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="description" content="">
        <meta name="generator" content="GitBook 3.2.3">
        <meta name="author" content="Patrick Zhong">
        
        
    
    <link rel="stylesheet" href="../../gitbook/style.css">

    
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-highlight/website.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-search/search.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-fontsettings/website.css">
                
            
        

    

    
        
    
        
    
        
    
        
    
        
    
        
    

        
    
    
    <meta name="HandheldFriendly" content="true"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link rel="apple-touch-icon-precomposed" sizes="152x152" href="../../gitbook/images/apple-touch-icon-precomposed-152.png">
    <link rel="shortcut icon" href="../../gitbook/images/favicon.ico" type="image/x-icon">

    
    <link rel="next" href="Common Errors.html" />
    
    
    <link rel="prev" href="this-in-TypeScript.html" />
    

    </head>
    <body>
        
<div class="book">
    <div class="book-summary">
        
            
<div id="book-search-input" role="search">
    <input type="text" placeholder="输入并搜索" />
</div>

            
                <nav role="navigation">
                


<ul class="summary">
    
    

    

    
        
        
    
        <li class="chapter " data-level="1.1" data-path="../../">
            
                <a href="../../">
            
                    
                    Introduction
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2" data-path="../handbook/tutorials/">
            
                <a href="../handbook/tutorials/">
            
                    
                    快速上手
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.2.1" data-path="../handbook/tutorials/TypeScript in 5 minutes.html">
            
                <a href="../handbook/tutorials/TypeScript in 5 minutes.html">
            
                    
                    5分钟了解TypeScript
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.2" data-path="../handbook/tutorials/ASP.NET Core.html">
            
                <a href="../handbook/tutorials/ASP.NET Core.html">
            
                    
                    ASP.NET Core
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.3" data-path="../handbook/tutorials/ASP.NET 4.html">
            
                <a href="../handbook/tutorials/ASP.NET 4.html">
            
                    
                    ASP.NET 4
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.4" data-path="../handbook/tutorials/Gulp.html">
            
                <a href="../handbook/tutorials/Gulp.html">
            
                    
                    Gulp
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.5" data-path="../handbook/tutorials/Knockout.html">
            
                <a href="../handbook/tutorials/Knockout.html">
            
                    
                    Knockout.js
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.6" data-path="../handbook/tutorials/React & Webpack.html">
            
                <a href="../handbook/tutorials/React & Webpack.html">
            
                    
                    React与webpack
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.7" data-path="../handbook/tutorials/React.html">
            
                <a href="../handbook/tutorials/React.html">
            
                    
                    React
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.8" data-path="../handbook/tutorials/Angular 2.html">
            
                <a href="../handbook/tutorials/Angular 2.html">
            
                    
                    Angular 2
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.9" data-path="../handbook/tutorials/Migrating from JavaScript.html">
            
                <a href="../handbook/tutorials/Migrating from JavaScript.html">
            
                    
                    从JavaScript迁移到TypeScript
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.3" data-path="../handbook/">
            
                <a href="../handbook/">
            
                    
                    手册
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.3.1" data-path="../handbook/Basic Types.html">
            
                <a href="../handbook/Basic Types.html">
            
                    
                    基础类型
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.2" data-path="../handbook/Variable Declarations.html">
            
                <a href="../handbook/Variable Declarations.html">
            
                    
                    变量声明
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.3" data-path="../handbook/Interfaces.html">
            
                <a href="../handbook/Interfaces.html">
            
                    
                    接口
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.4" data-path="../handbook/Classes.html">
            
                <a href="../handbook/Classes.html">
            
                    
                    类
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.5" data-path="../handbook/Functions.html">
            
                <a href="../handbook/Functions.html">
            
                    
                    函数
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.6" data-path="../handbook/Generics.html">
            
                <a href="../handbook/Generics.html">
            
                    
                    泛型
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.7" data-path="../handbook/Enums.html">
            
                <a href="../handbook/Enums.html">
            
                    
                    枚举
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.8" data-path="../handbook/Type Inference.html">
            
                <a href="../handbook/Type Inference.html">
            
                    
                    类型推论
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.9" data-path="../handbook/Type Compatibility.html">
            
                <a href="../handbook/Type Compatibility.html">
            
                    
                    类型兼容性
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.10" data-path="../handbook/Advanced Types.html">
            
                <a href="../handbook/Advanced Types.html">
            
                    
                    高级类型
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.11" data-path="../handbook/Utilit Types.md">
            
                <span>
            
                    
                    实用工具类型
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.12" data-path="../handbook/Symbols.html">
            
                <a href="../handbook/Symbols.html">
            
                    
                    Symbols
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.13" data-path="../handbook/Iterators and Generators.html">
            
                <a href="../handbook/Iterators and Generators.html">
            
                    
                    Iterators 和 Generators
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.14" data-path="../handbook/Modules.html">
            
                <a href="../handbook/Modules.html">
            
                    
                    模块
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.15" data-path="../handbook/Namespaces.html">
            
                <a href="../handbook/Namespaces.html">
            
                    
                    命名空间
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.16" data-path="../handbook/Namespaces and Modules.html">
            
                <a href="../handbook/Namespaces and Modules.html">
            
                    
                    命名空间和模块
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.17" data-path="../handbook/Module Resolution.html">
            
                <a href="../handbook/Module Resolution.html">
            
                    
                    模块解析
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.18" data-path="../handbook/Declaration Merging.html">
            
                <a href="../handbook/Declaration Merging.html">
            
                    
                    声明合并
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.19" data-path="../handbook/Writing Definition Files.html">
            
                <a href="../handbook/Writing Definition Files.html">
            
                    
                    书写.d.ts文件
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.20" data-path="../handbook/JSX.html">
            
                <a href="../handbook/JSX.html">
            
                    
                    JSX
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.21" data-path="../handbook/Decorators.html">
            
                <a href="../handbook/Decorators.html">
            
                    
                    Decorators
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.22" data-path="../handbook/Mixins.html">
            
                <a href="../handbook/Mixins.html">
            
                    
                    混入
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.23" data-path="../handbook/Triple-Slash Directives.html">
            
                <a href="../handbook/Triple-Slash Directives.html">
            
                    
                    三斜线指令
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.24" data-path="../handbook/Type Checking JavaScript Files.html">
            
                <a href="../handbook/Type Checking JavaScript Files.html">
            
                    
                    JavaScript文件里的类型检查
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.4" data-path="../handbook/declaration files/Introduction.html">
            
                <a href="../handbook/declaration files/Introduction.html">
            
                    
                    如何书写声明文件
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.4.1" data-path="../handbook/declaration files/Library Structures.html">
            
                <a href="../handbook/declaration files/Library Structures.html">
            
                    
                    结构
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.2" data-path="../handbook/declaration files/Do's and Don'ts.html">
            
                <a href="../handbook/declaration files/Do's and Don'ts.html">
            
                    
                    规范
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.3" data-path="../handbook/declaration files/By Example.html">
            
                <a href="../handbook/declaration files/By Example.html">
            
                    
                    举例
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.4" data-path="../handbook/declaration files/Deep Dive.html">
            
                <a href="../handbook/declaration files/Deep Dive.html">
            
                    
                    深入
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.5" data-path="../handbook/declaration files/Publishing.html">
            
                <a href="../handbook/declaration files/Publishing.html">
            
                    
                    发布
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.6" data-path="../handbook/declaration files/Consumption.html">
            
                <a href="../handbook/declaration files/Consumption.html">
            
                    
                    使用
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.5" data-path="../handbook/tsconfig.json.html">
            
                <a href="../handbook/tsconfig.json.html">
            
                    
                    工程配置
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.5.1" data-path="../handbook/tsconfig.json.html">
            
                <a href="../handbook/tsconfig.json.html">
            
                    
                    tsconfig.json
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.2" data-path="../handbook/Project References.html">
            
                <a href="../handbook/Project References.html">
            
                    
                    工程引用
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.3" data-path="../handbook/Typings for NPM Packages.html">
            
                <a href="../handbook/Typings for NPM Packages.html">
            
                    
                    NPM包的类型
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.4" data-path="../handbook/Compiler Options.html">
            
                <a href="../handbook/Compiler Options.html">
            
                    
                    编译选项
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.5" data-path="../handbook/Configuring Watch.html">
            
                <a href="../handbook/Configuring Watch.html">
            
                    
                    配置 Watch
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.6" data-path="../handbook/Compiler Options in MSBuild.html">
            
                <a href="../handbook/Compiler Options in MSBuild.html">
            
                    
                    在MSBuild里使用编译选项
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.7" data-path="../handbook/Integrating with Build Tools.html">
            
                <a href="../handbook/Integrating with Build Tools.html">
            
                    
                    与其它构建工具整合
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.8" data-path="../handbook/Nightly Builds.html">
            
                <a href="../handbook/Nightly Builds.html">
            
                    
                    使用TypeScript的每日构建版本
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.6" data-path="./">
            
                <a href="./">
            
                    
                    Wiki
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.6.1" data-path="this-in-TypeScript.html">
            
                <a href="this-in-TypeScript.html">
            
                    
                    TypeScript里的this
            
                </a>
            

            
        </li>
    
        <li class="chapter active" data-level="1.6.2" data-path="coding_guidelines.html">
            
                <a href="coding_guidelines.html">
            
                    
                    编码规范
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.3" data-path="Common Errors.html">
            
                <a href="Common Errors.html">
            
                    
                    常见编译错误
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.4" data-path="TypeScript-Editor-Support.html">
            
                <a href="TypeScript-Editor-Support.html">
            
                    
                    支持TypeScript的编辑器
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.5" data-path="Using-TypeScript-With-ASP.NET-5.html">
            
                <a href="Using-TypeScript-With-ASP.NET-5.html">
            
                    
                    结合ASP.NET v5使用TypeScript
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.6" data-path="Architectural-Overview.html">
            
                <a href="Architectural-Overview.html">
            
                    
                    架构概述
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.7" data-path="Roadmap.html">
            
                <a href="Roadmap.html">
            
                    
                    发展路线图
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.7" data-path="../release-notes/">
            
                <a href="../release-notes/">
            
                    
                    新增功能
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.7.1" data-path="../release-notes/TypeScript 3.1.html">
            
                <a href="../release-notes/TypeScript 3.1.html">
            
                    
                    TypeScript 3.1
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.2" data-path="../release-notes/TypeScript 3.0.html">
            
                <a href="../release-notes/TypeScript 3.0.html">
            
                    
                    TypeScript 3.0
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.3" data-path="../release-notes/TypeScript 2.9.html">
            
                <a href="../release-notes/TypeScript 2.9.html">
            
                    
                    TypeScript 2.9
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.4" data-path="../release-notes/TypeScript 2.8.html">
            
                <a href="../release-notes/TypeScript 2.8.html">
            
                    
                    TypeScript 2.8
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.5" data-path="../release-notes/TypeScript 2.7.html">
            
                <a href="../release-notes/TypeScript 2.7.html">
            
                    
                    TypeScript 2.7
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.6" data-path="../release-notes/TypeScript 2.6.html">
            
                <a href="../release-notes/TypeScript 2.6.html">
            
                    
                    TypeScript 2.6
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.7" data-path="../release-notes/TypeScript 2.5.html">
            
                <a href="../release-notes/TypeScript 2.5.html">
            
                    
                    TypeScript 2.5
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.8" data-path="../release-notes/TypeScript 2.4.html">
            
                <a href="../release-notes/TypeScript 2.4.html">
            
                    
                    TypeScript 2.4
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.9" data-path="../release-notes/TypeScript 2.3.html">
            
                <a href="../release-notes/TypeScript 2.3.html">
            
                    
                    TypeScript 2.3
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.10" data-path="../release-notes/TypeScript 2.2.html">
            
                <a href="../release-notes/TypeScript 2.2.html">
            
                    
                    TypeScript 2.2
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.11" data-path="../release-notes/TypeScript 2.1.html">
            
                <a href="../release-notes/TypeScript 2.1.html">
            
                    
                    TypeScript 2.1
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.12" data-path="../release-notes/TypeScript 2.0.html">
            
                <a href="../release-notes/TypeScript 2.0.html">
            
                    
                    TypeScript 2.0
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.13" data-path="../release-notes/TypeScript 1.8.html">
            
                <a href="../release-notes/TypeScript 1.8.html">
            
                    
                    TypeScript 1.8
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.14" data-path="../release-notes/TypeScript 1.7.html">
            
                <a href="../release-notes/TypeScript 1.7.html">
            
                    
                    TypeScript 1.7
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.15" data-path="../release-notes/TypeScript 1.6.html">
            
                <a href="../release-notes/TypeScript 1.6.html">
            
                    
                    TypeScript 1.6
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.16" data-path="../release-notes/TypeScript 1.5.html">
            
                <a href="../release-notes/TypeScript 1.5.html">
            
                    
                    TypeScript 1.5
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.17" data-path="../release-notes/TypeScript 1.4.html">
            
                <a href="../release-notes/TypeScript 1.4.html">
            
                    
                    TypeScript 1.4
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.18" data-path="../release-notes/TypeScript 1.3.html">
            
                <a href="../release-notes/TypeScript 1.3.html">
            
                    
                    TypeScript 1.3
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.19" data-path="../release-notes/TypeScript 1.1.html">
            
                <a href="../release-notes/TypeScript 1.1.html">
            
                    
                    TypeScript 1.1
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.8" data-path="../breaking-changes/breaking-changes.html">
            
                <a href="../breaking-changes/breaking-changes.html">
            
                    
                    Breaking Changes
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.8.1" data-path="../breaking-changes/TypeScript 2.4.html">
            
                <a href="../breaking-changes/TypeScript 2.4.html">
            
                    
                    TypeScript 2.4
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.2" data-path="../breaking-changes/TypeScript 2.3.html">
            
                <a href="../breaking-changes/TypeScript 2.3.html">
            
                    
                    TypeScript 2.3
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.3" data-path="../breaking-changes/TypeScript 2.2.html">
            
                <a href="../breaking-changes/TypeScript 2.2.html">
            
                    
                    TypeScript 2.2
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.4" data-path="../breaking-changes/TypeScript 2.1.html">
            
                <a href="../breaking-changes/TypeScript 2.1.html">
            
                    
                    TypeScript 2.1
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.5" data-path="../breaking-changes/TypeScript 2.0.html">
            
                <a href="../breaking-changes/TypeScript 2.0.html">
            
                    
                    TypeScript 2.0
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.6" data-path="../breaking-changes/TypeScript 1.8.html">
            
                <a href="../breaking-changes/TypeScript 1.8.html">
            
                    
                    TypeScript 1.8
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.7" data-path="../breaking-changes/TypeScript 1.7.html">
            
                <a href="../breaking-changes/TypeScript 1.7.html">
            
                    
                    TypeScript 1.7
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.8" data-path="../breaking-changes/TypeScript 1.6.html">
            
                <a href="../breaking-changes/TypeScript 1.6.html">
            
                    
                    TypeScript 1.6
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.9" data-path="../breaking-changes/TypeScript 1.5.html">
            
                <a href="../breaking-changes/TypeScript 1.5.html">
            
                    
                    TypeScript 1.5
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.10" data-path="../breaking-changes/TypeScript 1.4.html">
            
                <a href="../breaking-changes/TypeScript 1.4.html">
            
                    
                    TypeScript 1.4
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

    

    <li class="divider"></li>

    <li>
        <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
            本书使用 GitBook 发布
        </a>
    </li>
</ul>


                </nav>
            
        
    </div>

    <div class="book-body">
        
            <div class="body-inner">
                
                    

<div class="book-header" role="navigation">
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href="../.." >编码规范</a>
    </h1>
</div>




                    <div class="page-wrapper" tabindex="-1" role="main">
                        <div class="page-inner">
                            
<div id="book-search-results">
    <div class="search-noresults">
    
                                <section class="normal markdown-section">
                                
                                <!-- markdownlint-disable MD005 -->
<!-- markdownlint-disable MD029 -->
<p>&#x8FD9;&#x4E2A;&#x7F16;&#x7801;&#x89C4;&#x8303;&#x662F;&#x7ED9;TypeScript&#x5F00;&#x53D1;&#x56E2;&#x961F;&#x5728;&#x5F00;&#x53D1;TypeScript&#x65F6;&#x4F7F;&#x7528;&#x7684;&#x3002;
&#x5BF9;&#x4E8E;&#x4F7F;&#x7528;TypeScript&#x7684;&#x666E;&#x901A;&#x7528;&#x6237;&#x6765;&#x8BF4;&#x4E0D;&#x4E00;&#x5B9A;&#x9002;&#x7528;&#xFF0C;&#x4F46;&#x662F;&#x53EF;&#x4EE5;&#x505A;&#x4E3A;&#x4E00;&#x4E2A;&#x53C2;&#x8003;&#x3002;</p>
<h2 id="&#x547D;&#x540D;">&#x547D;&#x540D;</h2>
<ol>
<li>&#x4F7F;&#x7528;PascalCase&#x4E3A;&#x7C7B;&#x578B;&#x547D;&#x540D;&#x3002;</li>
<li>&#x4E0D;&#x8981;&#x4F7F;&#x7528;<code>I</code>&#x505A;&#x4E3A;&#x63A5;&#x53E3;&#x540D;&#x524D;&#x7F00;&#x3002;</li>
<li>&#x4F7F;&#x7528;PascalCase&#x4E3A;&#x679A;&#x4E3E;&#x503C;&#x547D;&#x540D;&#x3002;</li>
<li>&#x4F7F;&#x7528;camelCase&#x4E3A;&#x51FD;&#x6570;&#x547D;&#x540D;&#x3002;</li>
<li>&#x4F7F;&#x7528;camelCase&#x4E3A;&#x5C5E;&#x6027;&#x6216;&#x672C;&#x5730;&#x53D8;&#x91CF;&#x547D;&#x540D;&#x3002;</li>
<li>&#x4E0D;&#x8981;&#x4E3A;&#x79C1;&#x6709;&#x5C5E;&#x6027;&#x540D;&#x6DFB;&#x52A0;<code>_</code>&#x524D;&#x7F00;&#x3002;</li>
<li>&#x5C3D;&#x53EF;&#x80FD;&#x4F7F;&#x7528;&#x5B8C;&#x6574;&#x7684;&#x5355;&#x8BCD;&#x62FC;&#x5199;&#x547D;&#x540D;&#x3002;</li>
</ol>
<h2 id="&#x7EC4;&#x4EF6;">&#x7EC4;&#x4EF6;</h2>
<ol>
<li>1&#x4E2A;&#x6587;&#x4EF6;&#x5BF9;&#x5E94;&#x4E00;&#x4E2A;&#x903B;&#x8F91;&#x7EC4;&#x4EF6; &#xFF08;&#x6BD4;&#x5982;&#xFF1A;&#x89E3;&#x6790;&#x5668;&#xFF0C;&#x68C0;&#x67E5;&#x5668;&#xFF09;&#x3002;</li>
<li>&#x4E0D;&#x8981;&#x6DFB;&#x52A0;&#x65B0;&#x7684;&#x6587;&#x4EF6;&#x3002; :)</li>
<li><code>.generated.*</code>&#x540E;&#x7F00;&#x7684;&#x6587;&#x4EF6;&#x662F;&#x81EA;&#x52A8;&#x751F;&#x6210;&#x7684;&#xFF0C;&#x4E0D;&#x8981;&#x624B;&#x52A8;&#x6539;&#x5B83;&#x3002;</li>
</ol>
<h2 id="&#x7C7B;&#x578B;">&#x7C7B;&#x578B;</h2>
<ol>
<li>&#x4E0D;&#x8981;&#x5BFC;&#x51FA;&#x7C7B;&#x578B;/&#x51FD;&#x6570;&#xFF0C;&#x9664;&#x975E;&#x4F60;&#x8981;&#x5728;&#x4E0D;&#x540C;&#x7684;&#x7EC4;&#x4EF6;&#x4E2D;&#x5171;&#x4EAB;&#x5B83;&#x3002;</li>
<li>&#x4E0D;&#x8981;&#x5728;&#x5168;&#x5C40;&#x547D;&#x540D;&#x7A7A;&#x95F4;&#x5185;&#x5B9A;&#x4E49;&#x7C7B;&#x578B;/&#x503C;&#x3002;</li>
<li>&#x5171;&#x4EAB;&#x7684;&#x7C7B;&#x578B;&#x5E94;&#x8BE5;&#x5728;<code>types.ts</code>&#x91CC;&#x5B9A;&#x4E49;&#x3002;</li>
<li>&#x5728;&#x4E00;&#x4E2A;&#x6587;&#x4EF6;&#x91CC;&#xFF0C;&#x7C7B;&#x578B;&#x5B9A;&#x4E49;&#x5E94;&#x8BE5;&#x51FA;&#x73B0;&#x5728;&#x9876;&#x90E8;&#x3002;</li>
</ol>
<h2 id="null-&#x548C;-undefined&#xFF1A;"><code>null</code> &#x548C; <code>undefined</code>&#xFF1A;</h2>
<ol>
<li>&#x4F7F;&#x7528; <strong>undefined</strong>&#xFF0C;&#x4E0D;&#x8981;&#x4F7F;&#x7528; null&#x3002;</li>
</ol>
<h2 id="&#x4E00;&#x822C;&#x5047;&#x8BBE;">&#x4E00;&#x822C;&#x5047;&#x8BBE;</h2>
<ol>
<li>&#x5047;&#x8BBE;&#x50CF;Nodes&#xFF0C;Symbols&#x7B49;&#x8FD9;&#x6837;&#x7684;&#x5BF9;&#x8C61;&#x5728;&#x5B9A;&#x4E49;&#x5B83;&#x7684;&#x7EC4;&#x4EF6;&#x5916;&#x90E8;&#x662F;&#x4E0D;&#x53EF;&#x6539;&#x53D8;&#x7684;&#x3002;&#x4E0D;&#x8981;&#x53BB;&#x6539;&#x53D8;&#x5B83;&#x4EEC;&#x3002;</li>
<li>&#x5047;&#x8BBE;&#x6570;&#x7EC4;&#x662F;&#x4E0D;&#x80FD;&#x6539;&#x53D8;&#x7684;&#x3002;</li>
</ol>
<h2 id="&#x7C7B;">&#x7C7B;</h2>
<ol>
<li>&#x4E3A;&#x4E86;&#x4FDD;&#x6301;&#x4E00;&#x81F4;&#xFF0C;&#x5728;&#x6838;&#x5FC3;&#x7F16;&#x8BD1;&#x94FE;&#x4E2D;&#x4E0D;&#x8981;&#x4F7F;&#x7528;&#x7C7B;&#xFF0C;&#x4F7F;&#x7528;&#x51FD;&#x6570;&#x95ED;&#x5305;&#x4EE3;&#x66FF;&#x3002;</li>
</ol>
<h2 id="&#x6807;&#x8BB0;">&#x6807;&#x8BB0;</h2>
<ol>
<li>&#x4E00;&#x4E2A;&#x7C7B;&#x578B;&#x4E2D;&#x6709;&#x8D85;&#x8FC7;2&#x4E2A;&#x5E03;&#x5C14;&#x5C5E;&#x6027;&#x65F6;&#xFF0C;&#x628A;&#x5B83;&#x53D8;&#x6210;&#x4E00;&#x4E2A;&#x6807;&#x8BB0;&#x3002;</li>
</ol>
<h2 id="&#x6CE8;&#x91CA;">&#x6CE8;&#x91CA;</h2>
<p>&#x4E3A;&#x51FD;&#x6570;&#xFF0C;&#x63A5;&#x53E3;&#xFF0C;&#x679A;&#x4E3E;&#x7C7B;&#x578B;&#x548C;&#x7C7B;&#x4F7F;&#x7528;JSDoc&#x98CE;&#x683C;&#x7684;&#x6CE8;&#x91CA;&#x3002;</p>
<h2 id="&#x5B57;&#x7B26;&#x4E32;">&#x5B57;&#x7B26;&#x4E32;</h2>
<ol>
<li>&#x4F7F;&#x7528;&#x53CC;&#x5F15;&#x53F7;<code>&quot;&quot;</code></li>
<li>&#x6240;&#x6709;&#x8981;&#x5C55;&#x793A;&#x7ED9;&#x7528;&#x6237;&#x770B;&#x7684;&#x4FE1;&#x606F;&#x5B57;&#x7B26;&#x4E32;&#x90FD;&#x8981;&#x505A;&#x597D;&#x672C;&#x5730;&#x5316;&#x5DE5;&#x4F5C;&#xFF08;&#x5728;diagnosticMessages.json&#x4E2D;&#x521B;&#x5EFA;&#x65B0;&#x7684;&#x5B9E;&#x4F53;&#xFF09;&#x3002;</li>
</ol>
<h2 id="&#x9519;&#x8BEF;&#x63D0;&#x793A;&#x4FE1;&#x606F;">&#x9519;&#x8BEF;&#x63D0;&#x793A;&#x4FE1;&#x606F;</h2>
<ol>
<li>&#x5728;&#x53E5;&#x5B50;&#x7ED3;&#x5C3E;&#x4F7F;&#x7528;<code>.</code>&#x3002;</li>
<li>&#x5BF9;&#x4E0D;&#x786E;&#x5B9A;&#x7684;&#x5B9E;&#x4F53;&#x4F7F;&#x7528;&#x4E0D;&#x5B9A;&#x51A0;&#x8BCD;&#x3002;</li>
<li>&#x786E;&#x5207;&#x7684;&#x5B9E;&#x4F53;&#x5E94;&#x8BE5;&#x4F7F;&#x7528;&#x540D;&#x5B57;&#xFF08;&#x53D8;&#x91CF;&#x540D;&#xFF0C;&#x7C7B;&#x578B;&#x540D;&#x7B49;&#xFF09;</li>
<li>&#x5F53;&#x521B;&#x5EFA;&#x4E00;&#x6761;&#x65B0;&#x7684;&#x89C4;&#x5219;&#x65F6;&#xFF0C;&#x4E3B;&#x9898;&#x5E94;&#x8BE5;&#x4F7F;&#x7528;&#x5355;&#x6570;&#x5F62;&#x5F0F;&#xFF08;&#x6BD4;&#x5982;&#xFF1A;An external module cannot...&#x800C;&#x4E0D;&#x662F;External modules cannot&#xFF09;&#x3002;</li>
<li>&#x4F7F;&#x7528;&#x73B0;&#x5728;&#x65F6;&#x6001;&#x3002;</li>
</ol>
<h2 id="&#x9519;&#x8BEF;&#x63D0;&#x793A;&#x4FE1;&#x606F;&#x4EE3;&#x7801;">&#x9519;&#x8BEF;&#x63D0;&#x793A;&#x4FE1;&#x606F;&#x4EE3;&#x7801;</h2>
<p>&#x63D0;&#x793A;&#x4FE1;&#x606F;&#x88AB;&#x5212;&#x5206;&#x7C7B;&#x6210;&#x4E86;&#x4E00;&#x822C;&#x7684;&#x533A;&#x95F4;&#x3002;&#x5982;&#x679C;&#x8981;&#x65B0;&#x52A0;&#x4E00;&#x4E2A;&#x63D0;&#x793A;&#x4FE1;&#x606F;&#xFF0C;&#x5728;&#x4E0A;&#x6761;&#x4EE3;&#x7801;&#x4E0A;&#x52A0;1&#x505A;&#x4E3A;&#x65B0;&#x7684;&#x4EE3;&#x7801;&#x3002;</p>
<ul>
<li>1000 &#x8BED;&#x6CD5;&#x4FE1;&#x606F;</li>
<li>2000 &#x8BED;&#x8A00;&#x4FE1;&#x606F;</li>
<li>4000 &#x58F0;&#x660E;&#x751F;&#x6210;&#x4FE1;&#x606F;</li>
<li>5000 &#x7F16;&#x8BD1;&#x5668;&#x9009;&#x9879;&#x4FE1;&#x606F;</li>
<li>6000 &#x547D;&#x4EE4;&#x884C;&#x7F16;&#x8BD1;&#x5668;&#x4FE1;&#x606F;</li>
<li>7000 noImplicitAny&#x4FE1;&#x606F;</li>
</ul>
<h2 id="&#x666E;&#x901A;&#x65B9;&#x6CD5;">&#x666E;&#x901A;&#x65B9;&#x6CD5;</h2>
<p>&#x7531;&#x4E8E;&#x79CD;&#x79CD;&#x539F;&#x56E0;&#xFF0C;&#x6211;&#x4EEC;&#x907F;&#x514D;&#x4F7F;&#x7528;&#x4E00;&#x4E9B;&#x65B9;&#x6CD5;&#xFF0C;&#x800C;&#x4F7F;&#x7528;&#x6211;&#x4EEC;&#x81EA;&#x5DF1;&#x5B9A;&#x4E49;&#x7684;&#x3002;</p>
<ol>
<li>&#x4E0D;&#x4F7F;&#x7528;ECMAScript 5&#x51FD;&#x6570;&#xFF1B;&#x800C;&#x662F;&#x4F7F;&#x7528;<a href="https://github.com/Microsoft/TypeScript/blob/master/src/compiler/core.ts" target="_blank">core.ts</a>&#x8FD9;&#x91CC;&#x7684;&#x3002;</li>
<li>&#x4E0D;&#x8981;&#x4F7F;&#x7528;<code>for..in</code>&#x8BED;&#x53E5;&#xFF1B;&#x800C;&#x662F;&#x4F7F;&#x7528;<code>ts.forEach</code>&#xFF0C;<code>ts.forEachKey</code>&#x548C;<code>ts.forEachValue</code>&#x3002;&#x6CE8;&#x610F;&#x5B83;&#x4EEC;&#x4E4B;&#x95F4;&#x7684;&#x533A;&#x522B;&#x3002;</li>
<li>&#x5982;&#x679C;&#x53EF;&#x80FD;&#x7684;&#x8BDD;&#xFF0C;&#x5C1D;&#x8BD5;&#x4F7F;&#x7528;<code>ts.forEach</code>&#xFF0C;<code>ts.map</code>&#x548C;<code>ts.filter</code>&#x4EE3;&#x66FF;&#x5FAA;&#x73AF;&#x3002;</li>
</ol>
<h2 id="&#x98CE;&#x683C;">&#x98CE;&#x683C;</h2>
<ol>
<li>&#x4F7F;&#x7528;arrow&#x51FD;&#x6570;&#x4EE3;&#x66FF;&#x533F;&#x540D;&#x51FD;&#x6570;&#x8868;&#x8FBE;&#x5F0F;&#x3002;</li>
<li><p>&#x53EA;&#x8981;&#x9700;&#x8981;&#x7684;&#x65F6;&#x5019;&#x624D;&#x628A;arrow&#x51FD;&#x6570;&#x7684;&#x53C2;&#x6570;&#x62EC;&#x8D77;&#x6765;&#x3002;<br>&#x6BD4;&#x5982;&#xFF0C;<code>(x) =&gt; x + x</code>&#x662F;&#x9519;&#x8BEF;&#x7684;&#xFF0C;&#x4E0B;&#x9762;&#x662F;&#x6B63;&#x786E;&#x7684;&#x505A;&#x6CD5;&#xFF1A;</p>
<ol>
<li><code>x =&gt; x + x</code></li>
<li><code>(x,y) =&gt; x + y</code></li>
<li><code>&lt;T&gt;(x: T, y: T) =&gt; x === y</code></li>
</ol>
</li>
<li><p>&#x603B;&#x662F;&#x4F7F;&#x7528;<code>{}</code>&#x628A;&#x5FAA;&#x73AF;&#x4F53;&#x548C;&#x6761;&#x4EF6;&#x8BED;&#x53E5;&#x62EC;&#x8D77;&#x6765;&#x3002;</p>
</li>
<li>&#x5F00;&#x59CB;&#x7684;<code>{</code>&#x603B;&#x662F;&#x5728;&#x540C;&#x4E00;&#x884C;&#x3002;</li>
<li><p>&#x5C0F;&#x62EC;&#x53F7;&#x91CC;&#x5F00;&#x59CB;&#x4E0D;&#x8981;&#x6709;&#x7A7A;&#x767D;. <br>&#x9017;&#x53F7;&#xFF0C;&#x5192;&#x53F7;&#xFF0C;&#x5206;&#x53F7;&#x540E;&#x8981;&#x6709;&#x4E00;&#x4E2A;&#x7A7A;&#x683C;&#x3002;&#x6BD4;&#x5982;&#xFF1A;</p>
<ol>
<li><code>for (var i = 0, n = str.length; i &lt; 10; i++) { }</code></li>
<li><code>if (x &lt; 10) { }</code></li>
<li><code>function f(x: number, y: string): void { }</code></li>
</ol>
</li>
<li><p>&#x6BCF;&#x4E2A;&#x53D8;&#x91CF;&#x58F0;&#x660E;&#x8BED;&#x53E5;&#x53EA;&#x58F0;&#x660E;&#x4E00;&#x4E2A;&#x53D8;&#x91CF; <br>&#xFF08;&#x6BD4;&#x5982; &#x4F7F;&#x7528; <code>var x = 1; var y = 2;</code> &#x800C;&#x4E0D;&#x662F; <code>var x = 1, y = 2;</code>&#xFF09;&#x3002;</p>
</li>
<li><code>else</code>&#x8981;&#x5728;&#x7ED3;&#x675F;&#x7684;<code>}</code>&#x540E;&#x53E6;&#x8D77;&#x4E00;&#x884C;&#x3002;</li>
</ol>

                                
                                </section>
                            
    </div>
    <div class="search-results">
        <div class="has-results">
            
            <h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
            <ul class="search-results-list"></ul>
            
        </div>
        <div class="no-results">
            
            <h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
            
        </div>
    </div>
</div>

                        </div>
                    </div>
                
            </div>

            
                
                <a href="this-in-TypeScript.html" class="navigation navigation-prev " aria-label="Previous page: TypeScript里的this">
                    <i class="fa fa-angle-left"></i>
                </a>
                
                
                <a href="Common Errors.html" class="navigation navigation-next " aria-label="Next page: 常见编译错误">
                    <i class="fa fa-angle-right"></i>
                </a>
                
            
        
    </div>

    <script>
        var gitbook = gitbook || [];
        gitbook.push(function() {
            gitbook.page.hasChanged({"page":{"title":"编码规范","level":"1.6.2","depth":2,"next":{"title":"常见编译错误","level":"1.6.3","depth":2,"path":"doc/wiki/Common Errors.md","ref":"./doc/wiki/Common Errors.md","articles":[]},"previous":{"title":"TypeScript里的this","level":"1.6.1","depth":2,"path":"doc/wiki/this-in-TypeScript.md","ref":"./doc/wiki/this-in-TypeScript.md","articles":[]},"dir":"ltr"},"config":{"plugins":[],"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"highlight":{},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","author":"Patrick Zhong","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"preface.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"TypeScript Handbook","language":"zh-hans","gitbook":">3.0.0","description":"Translation of official TypeScript Handbook"},"file":{"path":"doc/wiki/coding_guidelines.md","mtime":"2018-10-13T09:48:54.000Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2018-10-13T09:57:42.904Z"},"basePath":"../..","book":{"language":""}});
        });
    </script>
</div>

        
    <script src="../../gitbook/gitbook.js"></script>
    <script src="../../gitbook/theme.js"></script>
    
        
        <script src="../../gitbook/gitbook-plugin-search/search-engine.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-search/search.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-lunr/lunr.min.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-lunr/search-lunr.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-sharing/buttons.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
        
    

    </body>
</html>

